<?php
mysql_connect(DBROOT,DBUSERNAME,DBPASSWORD);
mysql_query("SET NAMES UTF8");
mysql_select_db(DBNAME);
function query_schedule($userid){	
	$query="select distinct schedule.lessonindex,schedule.STARTWEEK,schedule.ENDWEEK,user.username from schedule,user where schedule.userid in
			(select user.userid from user where usergroup=$userid)
			and 
			schedule.userid=user.userid order by LESSONINDEX ASC";
	$result=mysql_query($query);
	return $result;
}
?>